<template>
  <a-form @submit="handleSubmit" :form="form" class="form">
    <a-row class="form-row" :gutter="16">
      <a-col :lg="8" :md="12" :sm="24">
        <a-form-item label="源研究方向序列" :labelCol="{span: 8,offset: 1}" :wrapperCol="{span: 14, offset: 1}">
          <a-select placeholder="请选择源研究方向序列" v-decorator="[ 'yzsnd', {rules: [{ required: true, message: '请选择源研究方向序列'}]} ]">
            <a-select-option v-for="i in TYPE0387" :key="i.id" :value="i.code">{{ i.name }}</a-select-option>
          </a-select>
        </a-form-item>
      </a-col>
      <a-col :lg="8" :md="12" :sm="24">
        <a-form-item label="本年度研究方向序列" :labelCol="{span: 8,offset: 1}" :wrapperCol="{span: 14, offset: 1}">
          <a-select placeholder="请选择本年度研究方向序列" v-decorator="[ 'zsnd', {rules: [{ required: true, message: '请选择本年度研究方向序列'}]} ]">
            <a-select-option v-for="i in TYPE0387" :key="i.id" :value="i.code">{{ i.name }}</a-select-option>
          </a-select>
        </a-form-item>
      </a-col>
      <a-col :lg="6" :md="10" :sm="20" :offset="2">
        <a-button type="primary" html-type="submit">初始化</a-button>
      </a-col>
    </a-row>
  </a-form>
</template>

<script>
export default {
  name: 'RepositoryForm',
  props: ['TYPE0387'],
  data () {
    return {
      form: this.$form.createForm(this)
    }
  },
  methods: {
    handleSubmit (e) {
      e.preventDefault()
      this.form.validateFields((err, values) => {
        if (!err) {
          this.$api.teacher.initialYjfx(values).then(res => {
            this.$message.success(res.msg)
          })
        }
      })
    }
  }
}
</script>

<style scoped>
</style>
